/// 重置密码请求模型
class ResetPasswordRequest {
  /// 重置令牌
  final String token;
  
  /// 新密码
  final String password;
  
  /// 确认密码
  final String confirmPassword;
  
  /// 构造函数
  ResetPasswordRequest({
    required this.token,
    required this.password,
    required this.confirmPassword,
  });
  
  /// 转换为JSON
  Map<String, dynamic> toJson() {
    return {
      'token': token,
      'password': password,
      'confirm_password': confirmPassword,
    };
  }
  
  /// 验证请求数据
  bool isValid() {
    // 验证令牌
    if (token.isEmpty) {
      return false;
    }
    
    // 验证密码
    if (password.isEmpty || confirmPassword.isEmpty) {
      return false;
    }
    
    // 验证密码一致性
    if (password != confirmPassword) {
      return false;
    }
    
    // 验证密码长度
    if (password.length < 8) {
      return false;
    }
    
    return true;
  }
  
  /// 创建一个新的重置密码请求，复制原有属性并覆盖指定属性
  ResetPasswordRequest copyWith({
    String? token,
    String? password,
    String? confirmPassword,
  }) {
    return ResetPasswordRequest(
      token: token ?? this.token,
      password: password ?? this.password,
      confirmPassword: confirmPassword ?? this.confirmPassword,
    );
  }
} 